package com.candy.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/login")
public class LoginServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        处理中文乱码问题
        req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");
        //      获取前端传递过来的参数
        String name= req.getParameter("name");
//        将参数保存在缓存中
        req.setAttribute("name",name);
//        跳转页面
        req.getRequestDispatcher("welcome.jsp").forward(req,resp);
    }


}
